class DependentObject1 {
    private data: string = '';
    public setData(data: string): void {
        this.data = data;
    }
    public getData(): string {
        return this.data;
    }
}

class DependentObject2 {
    private data: string = '';
    public setData(data: string): void {
        this.data = data;
    }
    public getData(): string {
        return this.data;
    }
}

class CoarseGrainedObject {
    do1: DependentObject1 = new DependentObject1();
    do2: DependentObject2 = new DependentObject2();
    public setData(data1: string, data2: string): void {
        this.do1.setData(data1);
        this.do2.setData(data2);
    }
    public getData(): string[] {
        return [this.do1.getData(), this.do2.getData()];
    }
}

class CompositeEntity {
    private cgo: CoarseGrainedObject = new CoarseGrainedObject();
    public setData(data1: string, data2: string): void {
        this.cgo.setData(data1, data2);
    }
    public getData(): string[] {
        return this.cgo.getData();
    }
}

class Client {
    private ce: CompositeEntity = new CompositeEntity();
    public showData(): void {
        this.ce.getData().forEach(data => console.log(data));
    }
    public setData(data1: string, data2: string): void {
        this.ce.setData(data1, data2);
    }
}

function main() {
    const client: Client = new Client();
    client.showData(); // Output: ""
    client.setData("data1", "data2");
    client.showData(); // Output: "data1", "data2"
    client.setData("new data1", "new data2");
    client.showData(); // Output: "new data1", "new data2"
}

main();
